package com.ehotting.edsta.diagnosisPredict.controller;

import com.ehotting.eaf.core.domain.R;
import com.ehotting.eaf.core.web.controller.BaseController;
import com.ehotting.edsta.diagnosisPredict.domain.dto.FeDatafield;
import com.ehotting.edsta.diagnosisPredict.domain.dto.FeDatafile;
import com.ehotting.edsta.diagnosisPredict.feign.FeDatafileFeignService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@Api(tags = "FeDatafileController",description = "特征工程原始数据文件接口")
@RestController
@RequestMapping("/feDatafile")
public class FeDatafileController extends BaseController {

    @Autowired
    private FeDatafileFeignService datafileFeignService;

    /**
     * 特征工程原始数据文件字段列表
     * @return
     */
    @ApiOperation(value = "特征工程原始数据文件字段列表",notes = "返回的数据类型：List\\<FeDatafield\\>")
    @ApiResponses(value = {
            @ApiResponse(code = 1,message = "",response = FeDatafield.class)
    })
    @PostMapping(value = "/uploadAnalyze")
    public R<List<FeDatafield>> uploadAnalyze(Long equipentityId, MultipartFile file, String fileDesc,
                                              Long iteminfoId, String itemname, Long processingId, Integer txtMethod){
        return R.convert(datafileFeignService.uploadAnalyze(equipentityId, file, fileDesc, iteminfoId, itemname, processingId,txtMethod));
    }

    /**
     * 特征工程原始数据文件字段列表
     * @return
     */
    @ApiOperation(value = "特征工程原始数据文件字段列表",notes = "返回的数据类型：FeDatafile")
    @ApiResponses(value = {
            @ApiResponse(code = 1,message = "",response = FeDatafile.class)
    })
    @PostMapping(value = "/analyzeSave")
    public R<FeDatafile> analyzeSave(Long id) {
        return R.convert(datafileFeignService.analyzeSave(id));
    }
}
